Return to doc.sitecore.com

Valid for Sitecore 6.x, 5.3
Creating a project in a virtual directory under Sitecore root

Q:

On our site I have created a virtual directory with an ASP.NET application that has nothing to do with Sitecore. It is a stand-alone application that is using no Sitecore functionality. I get the following error when accessing pages in the virtual directory - why?
 

Parser Error Message: File or assembly name Sitecore.HttpModule, or one of its dependencies, was not found. 

A:

The error occurs because four Sitecore HTTP Modules – SitecoreHttpModule, SitecoreUploadWatcher, SitecoreXslWatcher and SitecoreLayoutWatcher - are placed in the web.config file one level up your application (root web.config for the site), and their binaries are not accessible via your application’s probing path.

The official recommendation for this problem is:

You should dedicate a separate Web Site just for Sitecore.

However, if you deploy Sitecore-based solution on machine running Windows XP (which is limited to just one site) and it is absolutely necessary to deploy another web application on the same server, you can resort to a trick to circumvent the problem.

First thing to do is to remove Sitecore HTTP Modules in the virtual directory’s web.config:

For Sitecore CMS 6.x: 

<configuration>
      <httpModules>
        <remove name="SitecoreHttpModule" />
        <remove name="SitecoreUploadWatcher" />
        <remove name="SitecoreXslWatcher" />
        <remove name="SitecoreLayoutWatcher" />
        <remove name="SitecoreConfigWatcher" />
      </httpModules>
      
      <roleManager enabled="false">
        <providers>
          <clear/>
        </providers>
      </roleManager>
 
      <profile enabled="false">
        <providers>
          <clear />
        </providers>
      </profile>
      
      <httpHandlers>
        <remove verb="*" path="sitecore_media.ashx"/>
        <remove verb="*" path="sitecore_xaml.ashx"/>
        <remove verb="*" path="sitecore_icon.ashx"/>
      </httpHandlers>
    </system.web>
</configuration>

For Sitecore CMS 5.3:

<configuration>

      <httpModules>

        <remove name="SitecoreHttpModule" />

        <remove name="SitecoreUploadWatcher" />

        <remove name="SitecoreXslWatcher" />

        <remove name="SitecoreLayoutWatcher" />

        <remove name="SitecoreConfigWatcher" />

      </httpModules>

 

      <roleManager enabled="false">

        <providers>

          <clear/>

        </providers>

      </roleManager>

 

      <httpHandlers>

        <remove verb="*" path="sitecore_media.ashx"/>

      </httpHandlers>

    </system.web>

</configuration>

These settings prevent the HTTP modules from being executed.

Note: virtual directory should have the /bin subfolder.

In the Sitecore root web.config add the Virtual directory to IgnoreURL setting:

<setting name="IgnoreUrlPrefixes" value="/trace.axd|/sitecore/shell/Editor|/sitecore/admin/

upgrade/|UnhandledException.html|/MyVirtual/" />

Please note that this is not a recommended thing to do.